package cn.sciento.boot.data.change.selector;

import io.choerodon.mybatis.MapperException;
import io.choerodon.mybatis.domain.EntityTable;
import io.choerodon.mybatis.helper.EntityHelper;
import io.choerodon.mybatis.helper.MapperTemplate;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class DefaultEntityTableSelector extends AbstractEntityTableSelector {
  private static final Logger LOGGER = LoggerFactory.getLogger(DefaultEntityTableSelector.class);
  
  public EntityTable getEntityTable(SqlInfo sqlInfo) {
    EntityTable tableByMapper = null;
    try {
      tableByMapper = EntityHelper.getTableByMapper(MapperTemplate.getMapperClassName(sqlInfo.getMappedStatementId()));
    } catch (MapperException e) {
      LOGGER.info("not found table for mapper class");
    } 
    return tableByMapper;
  }
}
